home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Astronomy / Moon / Source / mymath.h < prev    next >
Text File  |  1993-01-19  |  825b  |  23 lines

  1. /* mymath.h
  2.  * Part of the Moon application for the NeXT computer.
  3.  * Authors:  John Walker of Autodesk
  4.  *           Geoffrey S. Knauth (NeXT port)
  5.  * Date:     January 4, 1992
  6.  *
  7.  * This code was placed in the public domain by John Walker.
  8.  */
  9.  
  10. #define PI 3.14159265358979323846  /* Assume not near black hole nor in
  11.                       Tennessee */
  12.  
  13. /*  Handy mathematical functions  */
  14.  
  15. #define sgn(x) (((x) < 0) ? -1 : ((x) > 0 ? 1 : 0))      /* Extract sign */
  16. #define abs(x) ((x) < 0 ? (-(x)) : (x))           /* Absolute val */
  17. #define fixangle(a) ((a) - 360.0 * (floor((a) / 360.0)))  /* Fix angle      */
  18. #define torad(d) ((d) * (PI / 180.0))              /* Deg->Rad      */
  19. #define todeg(d) ((d) * (180.0 / PI))              /* Rad->Deg      */
  20. #define dsin(x) (sin(torad((x))))              /* Sin from deg */
  21. #define dcos(x) (cos(torad((x))))              /* Cos from deg */
  22.  
  23.